package com.dreamcode.anfeedreader.activity;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class TabMainActivity extends TabActivity {

	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.main);

	    Resources res = getResources();
	    TabHost tabHost = getTabHost();
	    TabHost.TabSpec spec;
	    Intent intent;

	    // Create an Intent to launch an Activity for the tab (to be reused)
	    intent = new Intent().setClass(this, AnFeedReader.class);

	    // Initialize a TabSpec for each tab and add it to the TabHost
	    spec = tabHost.newTabSpec("feedList").setIndicator("Feed Lists",
	                      res.getDrawable(R.drawable.ic_tab_feedlists))
	                  .setContent(intent);
	    tabHost.addTab(spec);

	    // Do the same for the other tabs
	    intent = new Intent().setClass(this, RelevantFeedItems.class);
	    spec = tabHost.newTabSpec("relevantItems").setIndicator("Marked Items",
	                      res.getDrawable(R.drawable.ic_tab_relevantitems))
	                  .setContent(intent);
	    tabHost.addTab(spec);

	    intent = new Intent().setClass(this, SearchFeedItemsActivity.class);
	    spec = tabHost.newTabSpec("search").setIndicator("Search",
	                      res.getDrawable(R.drawable.ic_tab_search))
	                  .setContent(intent);
	    tabHost.addTab(spec);
	    
	    intent = new Intent().setClass(this, AccountSettingsActivity.class);
	    spec = tabHost.newTabSpec("accounts").setIndicator("Accouts Settings",
	                      res.getDrawable(R.drawable.ic_tab_accounts))
	                  .setContent(intent);
	    tabHost.addTab(spec);

	    tabHost.setCurrentTab(2);
	}
}
